#
#	Makefile for doxygen
#

@SET_MAKE@

SHELL = /bin/sh
DOXYGEN = doxygen
srcdir= @srcdir@
top_srcdir= @top_srcdir@
configdir=@top_srcdir@/@configdir@

include $(configdir)/@common_makefile@


all: html man

html:
	$(DOXYGEN) htmldocs.cfg

man:
	$(DOXYGEN) manpages.cfg
	rm -f manpages/man1/*.man.1
	./patchman.sh

text:
	$(configdir)/mkinstalldirs man2text
	cd manpages/man1/ ;\
	for file in *.1 ; do \
		man -l $$file | col -bx > ../../man2text/`echo $$file | sed 's/\(.*\.\)1/\1txt/'` ;\
	done


install: install-man install-html

install-man:
	$(configdir)/mkinstalldirs $(mandir)/man1
	for file in manpages/man1/*.1 ; do \
		$(INSTALL_DATA) $$file $(mandir)/man1 ;\
	done

install-html:
	$(configdir)/mkinstalldirs $(docdir)/html
	if [ ! -f htmldocs/index.html ] ; then \
		$(DOXYGEN) htmldocs.cfg ;\
	fi
	for file in htmldocs/* ; do \
		$(INSTALL_DATA) $$file $(docdir)/html ;\
	done


clean:
	rm -f *.log $(TRASH)

distclean:
	rm -rf *.log htmldocs man2text $(DISTTRASH)
